using System.Collections;
using UnityEngine;
using UnityEngine.UI;

public class FloatTip : MonoBehaviour
{
	public Text m_Text;

	public AnimationTools m_aniTools;

	private void Start()
	{
	}

	private void Update()
	{
	}

	public static void Show(string text)
	{
		if (!GameManager.CurrentUIRoot.transform.Find("FloatTip"))
		{
			FloatTip floatTip = SupportTools.AddChild<FloatTip>(GameManager.CurrentUIRoot.gameObject, "UI/FloatTip");
			floatTip.gameObject.SetActive(value: true);
			floatTip.m_Text.text = text;
			floatTip.name = "FloatTip";
		}
	}

	public static void Show(int id)
	{
		Show(HOLocalizationConfiguration.GetValue(id));
	}

	public void OnFloatTipShown()
	{
		StartCoroutine(HideFloatTip());
	}

	private IEnumerator HideFloatTip()
	{
		yield return new WaitForSeconds(1.5f);
		m_aniTools.Trigger("Hide");
	}
}
